﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NJL.Web.Controls
{
    public partial class WUCIndexSmallFarmHouse : BaseUserControl
    {
        private readonly BLL.NJL_COMPANY bllCompany = new BLL.NJL_COMPANY();
        protected IList<Model.NJL_COMPANY> listCompany;
        NJL.BLL.NJL_SYS_NEWS bllSysNews = new BLL.NJL_SYS_NEWS();
        protected int TOP_6_COMPANY_COUNT = 6;
        protected int LAST_COMPANY_COUNT = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            LoadData();
            if (!IsPostBack)
            {
                rptNews.DataSource = bllSysNews.GetList(3, "NJL_SYS_BASE_ID='" + WEBSITE_CODE + "' and TYPE_CODE='19' and IS_INDEX=1 and IS_PUBLISH=1", "SORT DESC,PUBLISH_DATE_TIME desc");
             rptNews.DataBind();
            }
        }

        private void LoadData()
        {
            listCompany = bllCompany.IndexGetModelList(this.WEBSITE_CODE,this.WEBSITE_FOCUS_CITY_CODE,"1",14);

            if (listCompany.Count < 6)
            {
                TOP_6_COMPANY_COUNT = listCompany.Count;
            }
            else
            {
                LAST_COMPANY_COUNT = listCompany.Count - 6;
            }
        }
    }
}